TARGET=ARCH

CXX=g++
FLAGS=$(shell root-config --cflags)

SoftwarePath=${HOME}/Software/bin
LibPath=${HOME}/Software/lib
RootInclude=$(shell root-config --incdir)
YAMLPath=${LibPath}/yaml-cpp/install
MGPath=${SoftwarePath}/MG5_aMC_v3_5_3
DelphesPath=${MGPath}/Delphes
DelphesextPath=${DelphesPath}/external
BoostPath=${LibPath}/boost_1_84_0

INCLUDE = -I. -I..  -I$(RootInclude)/\
		    -I$(DelphesPath) \
		    -I$(DelphesextPath) \
            -I$(DelphesextPath)/ExRootAnalysis\
		    -I${YAMLPath}/include \
			-I${BoostPath}


LIBS=-L${BoostPath}/stage/lib -lboost_filesystem -lboost_system  -Wl,-rpath,$(DelphesPath) -L$(DelphesPath) -lDelphes ${YAMLPath}/lib64/libyaml-cpp.a  
#FASTLIBS=-Wl,-rpath,${FastjetPath} -L${FastjetPath} -lfastjettools -lfastjet
ROOTLIBS=$(shell root-config --libs)
FASTLIBS := $(shell fastjet-config --libs)

SRCS = \
src/$(TARGET).cpp \
src/Fram/Fram.cpp src/Fram/Fsection.cpp \
src/Function/FString.cpp src/Function/Fbasic.cpp src/Function/Fvector.cpp src/Function/Ffastjet.cpp src/Function/Fdelphes.cpp src/Function/Froot.cpp src/Function/Ffile.cpp \
src/Function/FTLorentzVector.cpp src/Function/FMath.cpp\
src/Lib/MessageFormat.cpp src/Lib/PlotSetting.cpp src/Lib/libstructure.cpp src/Lib/Define.cpp src/Lib/YAML_Assistant.cpp\
src/Class/DrawClass.cpp src/Class/Path.cpp src/Class/Status.cpp src/Class/Detector.cpp src/Class/File.cpp src/Class/Signal.cpp src/Class/Flow.cpp src/Class/Event.cpp\
src/Class/Variable.cpp \
src/Class/AAngle_Self.cpp src/Class/AComb_LTV.cpp src/Class/ACut.cpp src/Class/AAngle_Inter.cpp src/Class/AComb_Vector.cpp\
src/RWpara/RWfile.cpp src/RWpara/RWDraw.cpp src/RWpara/RWbasic.cpp src/RWpara/RWEvent.cpp src/RWpara/RWcombine.cpp src/RWpara/RWglobal.cpp src/RWpara/RWjet.cpp\
src/RWpara/RWlepton.cpp src/RWpara/RWmet.cpp src/RWpara/RWphoton.cpp src/RWpara/RWrecoil.cpp src/RWpara/RWjep.cpp src/RWpara/RWTag.cpp\
src/RWpara/RWMassDrop.cpp src/RWpara/RWNSubjettiness.cpp src/RWpara/RWBoostTag.cpp src/RWpara/RWJetSubStructure.cpp src/RWpara/RWVar.cpp\
src/RWpara/RWDetector.cpp \
src/Analyse/Analyse.cpp src/Analyse/Abasic.cpp \
src/Analyse_Combine/Acombine.cpp src/Analyse_Combine/Acomb_func.cpp src/Analyse_Combine/Acomb_resonance.cpp src/Analyse_Combine/Acomb_recoil.cpp \
src/Analyse_Combine/Arecoil.cpp src/Analyse_Combine/AN_rc_w_lnu.cpp src/Analyse_Combine/Acomb_particle.cpp src/Analyse_Combine/Acomb_func_with_acut.cpp\
src/Analyse_Combine/Acomb_resonance.cpp \
src/Analyse_Detector_Particle/ALepton.cpp src/Analyse_Detector_Particle/ABTag.cpp\
src/Analyse_Detector_Particle/Aparticle.cpp \
src/Analyse_Detector_Simulation/Aequipment.cpp src/Analyse_Detector_Simulation/Adetector.cpp \
src/Analyse_Detector_Simulation/Adetector_lep.cpp src/Analyse_Detector_Simulation/Adetector_jet.cpp src/Analyse_Detector_Simulation/Adetector_met.cpp \
src/Analyse_Detector_Simulation/Adetector_photon.cpp src/Analyse_Detector_Simulation/Adetector_make_signal.cpp src/Analyse_Detector_Simulation/Aslcio_particle.cpp \
src/Analyse_Jet_Substructure/Ajep.cpp src/Analyse_Jet_Substructure/Ajet_function.cpp src/Analyse_Jet_Substructure/ANSubjettiness.cpp src/Analyse_Jet_Substructure/AJetSubStructure.cpp \
src/Analyse_Jet_Tag/AMassDrop.cpp src/Analyse_Jet_Tag/AHiggsTag.cpp \
src/Book/Book_single.cpp src/Book/Bfunc_single.cpp src/Book/Book_multi.cpp src/Book/Bfunc_multi.cpp \
src/AnalyseClass/Particle.cpp  src/AnalyseClass/Pool.cpp src/AnalyseClass/Pair.cpp  src/AnalyseClass/Lepton.cpp src/AnalyseClass/Object.cpp src/AnalyseClass/Jet.cpp\
src/AnalyseClass/Stdhep.cpp src/AnalyseClass/Slcio.cpp src/AnalyseClass/Delphes.cpp src/AnalyseClass/AnalyseClass.cpp \
src/AnalyseClass/Counter.cpp src/AnalyseClass/ParticleFunction.cpp  src/AnalyseClass/Species.cpp   \
src/AnalyseClass/Object_Lepton.cpp src/AnalyseClass/Object_Jet.cpp  src/AnalyseClass/Object_Particle.cpp src/AnalyseClass/Object_Combine.cpp\
src/Function/Ftest.cpp

OBJS=$(patsubst %.cpp, %.o, $(SRCS))

$(TARGET): $(OBJS)
	$(CXX) $(FLAGS) $(INCLUDE) -o $@ $^ $(FASTLIBS) $(ROOTLIBS)  $(LIBS)

%.o: %.cpp
	$(CXX) $(FLAGS) $(INCLUDE) -c $<  -o  $@

install:
	mv $(TARGET) ./bin/

clean:
	-rm $(TARGET) $(OBJS)
